import React, { Component } from 'react'
import axios from 'axios'

export default class App extends Component {
  getStudentData=()=>{
    axios.get('http://localhost:3000/api1/students').then(
      (response)=>{
        console.log(response.data);
    },(error)=>{
      console.log(error);
    })
  }
  getCarData=()=>{
    axios.get('http://localhost:3000/api2/cars').then(
      (response)=>{
        console.log(response.data);
    },(error)=>{
      console.log(error);
    })
  }
  render() {
    return (
      <div>
        <button onClick={this.getStudentData}>点我请求学生信息</button>
        <button onClick={this.getCarData}>点我请求汽车信息</button>
      </div>
    )
  }
}
